
export function inputClass (refs, data) {
  // input的框添加class
  if (data.length > 0 && refs[data[0]]) {
    if (refs[data[0]] && refs[data[0]].$refs) {
      let inputs = refs[data[0]].$refs.input.getAttribute('class').split(' ')
      let flag = inputs.find(elem => { return elem === data[0] })
      if (!flag) {
        for (var i in data) {
          if (refs[data[i]] && refs[data[i]].$refs) {
            refs[data[i]].$refs.input.classList.value += ' ' + data[i]
          }
        }
      }
    }

  }
}

export function texttextClass (refs, textdata) {
  // textarea框添加class
  if (textdata.length > 0 && refs[textdata[0]]) {
    if (refs[textdata[0]] && refs[textdata[0]].$refs) {
      let textdatas = refs[textdata[0]].$refs.textarea.getAttribute('class').split(' ')
      let flags = textdatas.find(elems => { return elems === textdata[0] })
      if (!flags) {
        for (var j in textdata) {
          if (refs[textdata[j]] && refs[textdata[j]].$refs) {
            refs[textdata[j]].$refs.textarea.classList.value += ' ' + textdata[j]
          }
        }
      }
    }
  }
}

export function selectClass (refs, selectdata) {
  // selsect添加class
  if (selectdata.length > 0 && refs[selectdata[0]]) {
    let selectdatas = refs[selectdata[0]].$refs.reference.$refs.input.getAttribute('class').split(' ')
    let flags = selectdatas.find(item => { return item === selectdata[0] })
    if (!flags) {
      for (var j in selectdata) {
        if (refs[selectdata[j]] && refs[selectdata[j]].$refs) {
          refs[selectdata[j]].$refs.reference.$refs.input.classList.value += ' ' + selectdata[j]
        }
      }
    }
  }
}

export function autocompleteClass (refs, autocompletedata) {
  // autocomplete添加class

  if (autocompletedata.length > 0 && refs[autocompletedata[0]]) {
    let autocompletedatas = refs[autocompletedata[0]].$refs.input.$refs.input.getAttribute('class').split(' ')
    let flags = autocompletedatas.find(item => { return item === autocompletedata[0] })
    if (!flags) {
      for (var j in autocompletedata) {
        refs[autocompletedata[j]].$refs.input.$refs.input.classList.value += ' ' + autocompletedata[j]
      }
    }
  }
}
